#include<cstdio>
#include<cstring>
using namespace std;
const int MAX = 1000005;
int f[MAX], next[MAX];

void getNext(int next[], char s[]){
	int len = strlen(s);
	next[0] = -1;
	for(int i=1, j=-1;i<len;i++){
		while(j != -1 && s[i] != s[j+1]){
			j = next[j];
		}
		if(s[i] == s[j+1]){
			j++;
		}
		next[i] = j;
	}
}

int kmp(char s[], char t[]){
	int lens = strlen(s), lent = strlen(t), i = 0, j = 0;
	getNext(next, t);
	
	for(i = 0, j = -1; i < lens; i++){
		while(j != -1 && (j == lent-1 || s[i] != t[j+1])){
			j = next[j];
		}
		if(s[i] == t[j+1]){
			j++;
		}
		if(j == lent-1){
			printf("%d ", i-lent+1);
		}
	}
}

int main(){
	char s[MAX], t[MAX];
	scanf("%s %s", s, t);

	kmp(s, t);

	return 0;
}
